import { MenuState } from '@/interfaces/vuex/menu'
import { MessageModelState } from '@/interfaces/vuex/message'
import { StoreOptions } from 'vuex'
import menuModel from './menuModel'
import messageModel from './messageModel'
import historyLinkModel from './historyLinkmodel'
import { HistoryLinkState } from '@/interfaces/vuex/historyLink'
import { CacheModelState } from '@/interfaces/vuex/cache'
import cacheModel from './cache'

interface StoresState extends MessageModelState, MenuState, HistoryLinkState, CacheModelState {}

const stores: StoreOptions<StoresState> = {
  state: {
    ...(messageModel.state as MessageModelState),
    ...(menuModel.state as MenuState),
    ...(historyLinkModel.state as HistoryLinkState),
    ...(cacheModel.state as CacheModelState),
  },
  mutations: {
    ...messageModel.mutations,
    ...menuModel.mutations,
    ...historyLinkModel.mutations,
    ...cacheModel.mutations,
  },
  actions: {
    ...messageModel.actions,
    ...menuModel.actions,
    ...historyLinkModel.actions,
    ...cacheModel.actions,
  },
}

export default stores
